package homeWork.SOC5.mission_extra;


/**
 * 家书 实体描述类
 *       实现接口:家书
 */
public class HomeLetterImpl implements HomeLetter {

    private String Title;
    private String Hello;
    private String Body;
    private String Greeting;
    private String Selft;

    public HomeLetterImpl(){
    }

    public HomeLetterImpl(String title, String hello, String body,
                          String greeting, String selft) {
        Title = title;
        Hello = hello;
        Body = body;
        Greeting = greeting;
        Selft = selft;
    }

    public void setTitle(String title) {
        Title = title;
    }

    public void setHello(String hello) {
        Hello = hello;
    }

    public void setBody(String body) {
        Body = body;
    }

    public void setGreeting(String greeting) {
        Greeting = greeting;
    }

    public void setSelft(String selft) {
        Selft = selft;
    }

    @Override
    public String writeTitle() {
        return Title + "\n";
    }

    @Override
    public String writeHello() {
        return normalRetract() + Hello + "\n\n";
    }

    @Override
    public String writeBody() {
        return normalRetract() + Body + "\n\n";
    }

    @Override
    public String writeGreeting() {
        return normalRetract() + Greeting + "\n";
    }

    @Override
    public String writeSelft() {
        return selftRetract() + Selft + "\n";
    }

    //普通缩进
    public String normalRetract(){
        return "　　";
    }

    //落款缩进对齐
    public String selftRetract(){
        return "　　　　　　　　　　　　　　　";
    }

    public String printArticle(){
        return writeTitle() + writeHello() + writeBody() +
                writeGreeting() + writeSelft();
    }
}
